package redis

import (
	"fmt"
	"github.com/go-redis/redis"
	"store/appconfig"
)

var Client *redis.Client

func ExampleNewClient() {
	Data := appconfig.Data.Redis
	Client = redis.NewClient(&redis.Options{
		Addr:     Data.Addr,
		Password: Data.Password,
		DB:       Data.DB,
	})
	pong, err := Client.Ping().Result()
	if err != nil {
		panic("redis连接失败")
	} else {
		fmt.Println("redis连接成功")
	}

	fmt.Println(pong, err)
	// Output: PONG <nil>
}
